<?php

namespace App\Models\Edu;

use Illuminate\Database\Eloquent\Model;
use Laracasts\Presenter\PresentableTrait;

class Tuser extends Model
{
    use PresentableTrait;

	protected $table = 'edu_users';

    protected $guarded = array();

    protected $with = ['info'];

    protected $presenter = 'App\Http\Presenters\TuserPresenter';

    public function branch()
    {
        return $this->belongsTo('\App\Models\Mgt\Branch');
    }


    public function type()
    {
        return $this->belongsTo('\App\Models\Edu\Type');
    }


    public function term()
    {
        return $this->belongsTo('\App\Models\Edu\Term');
    }


    public function category()
    {
        return $this->belongsTo('\App\Models\Edu\Category');
    }


    public function clase()
    {
        return $this->belongsTo('\App\Models\Edu\Clase');
    }


    /**
     * 用户详细信息
     * @return [type] [description]
     */
    public function info()
    {
        return $this->belongsTo('\App\Models\Mgt\User','uid');
    }


    public function attachments()
    {
        return $this->hasMany('\App\Models\Edu\Attachment','tuser_id');
    }
}